<% layout('/layouts/default.html', {title: 'ab_temp管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i>
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('ab:abTemp:edit')){ %>
					<a href="${ctx}/ab/abTemp/form" class="btn btn-default btnTool" title="${text('新增ab_temp')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${abTemp}" action="${ctx}/ab/abTemp/listData" method="post" class="form-inline"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('用户名')}：</label>
					<div class="control-inline">
						<#form:input path="name" maxlength="255" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('供热公司部门')}：</label>
					<div class="control-inline width-120" >
						<#form:treeselect id="officeId" title="${text('机构选择')}"
							path="officeId" labelPath="" 
							url="${ctx}/sys/office/treeData" allowClear="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('行政区域')}：</label>
					<div class="control-inline width-120" >
						<#form:treeselect id="areaId" title="${text('区域选择')}"
							path="areaId" labelPath="" 
							url="${ctx}/sys/area/treeData" allowClear="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('小区楼宇')}：</label>
					<div class="control-inline">
						<#form:input path="floor" maxlength="64" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('清空')}</button>
					<button  id="btnExport" class="btn btn-default btn-sm">${text('导出')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("用户名")}', name:'name', index:'a.name', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/ab/abTemp/form?id='+row.id+'" class="btnList" data-title="${text("编辑ab_temp")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("供热公司部门")}', name:'office.officeName', index:'a.office_id', width:150, align:"center"},
		{header:'${text("行政区域")}', name:'area.areaName', index:'a.area_id', width:150, align:"center"},
		{header:'${text("小区楼宇")}', name:'floor', index:'a.floor', width:150, align:"left"},
		{header:'${text("测温ID")}', name:'tempId', index:'a.temp_id', width:150, align:"left"},
		{header:'${text("当前温度")}', name:'nowTemp', index:'a.now_temp', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, '') + "℃"; // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("室外温度")}', name:'outTemp', index:'a.out_temp', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, '') + "℃"; // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("上传时间")}', name:'uploadTime', index:'a.upload_time', width:150, align:"center"},
		{header:'${text("地址")}', name:'address', index:'a.address', width:150, align:"left"},
		{header:'${text("面积")}', name:'areas', index:'a.areas', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("操作")}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			actions.push('&nbsp;&nbsp;&nbsp;<a href="${ctx}/ab/abTemp/form?id='+row.id+'" class="btnList" title="${text("每日温度")}"><img src="${ctxStatic}/swjk35.png"/>&nbsp;&nbsp;&nbsp;&nbsp;');
			actions.push('<a href="${ctx}/ab/abTemp/delete?id='+row.id+'" class="btnList" title="${text("历史温度")}"><img src="${ctxStatic}/swjk34.png"/>&nbsp;');
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}

});
$('#btnExport').click(function(){
    js.ajaxSubmitForm($('#searchForm'), {
        url:'${ctx}/ab/abTemp/exportData',
        downloadFile:true
    });
});
</script>